﻿Public Class Form1
  Private stato As String = "Stop"
  Private Sub Inizia_Click(ByVal sender _
          As System.Object, _
          ByVal e As System.EventArgs) _
          Handles Inizia.Click
    stato = "Start"
    Me.Arresta.Focus()
    Dim i As Long = 0
    Do While i <= 2000000000 _
            And stato = "Start"
      Me.TextBox1.Text = i.ToString
      My.Application.DoEvents()
      i += 1
    Loop
  End Sub
  Private Sub Arresta_Click(ByVal sender _
          As System.Object, _
          ByVal e As System.EventArgs) _
          Handles Arresta.Click
    If Integer.Parse(Me.TextBox1.Text) >= _
            10000 Then
      stato = "Stop"
    End If
  End Sub
End Class
